/**
 * 
 */
package com.apache.website.service.plugins;

import com.apache.api.manager.PluginConnector;
import com.apache.api.vo.ParamsVo;
import com.apache.api.vo.ResultEntity;
import com.apache.database.constant.Validator;
import com.apache.website.entity.Manuscript;
import com.apache.website.manager.ManuscriptManager;

/**
 * @author dyhou
 *
 */
public class ManuscriptEntityPluginImpl implements PluginConnector {

	private ManuscriptManager manuscriptManager;

	/* (non-Javadoc)
	 * @see com.apache.api.manager.PluginConnector#execute(com.apache.api.vo.ParamsVo)
	 */
	public Object execute(ParamsVo param) throws Exception {
		String manuscriptId = String.valueOf(param.getParams("manuscriptId"));
		ResultEntity entity = new ResultEntity();
		if (Validator.isNull(manuscriptId)) {
			entity.setResult("false");
			entity.setMessage("缺少必要参数");
			return entity;
		}
		ParamsVo<Manuscript> vo = new ParamsVo<Manuscript>();
		vo.setInfoId(manuscriptId);
		vo.setMethodKey("AllById");
		Manuscript manuscript = (Manuscript) manuscriptManager.getInfoById(vo);
		entity.setEntity(manuscript);
		entity.setResult("true");
		entity.setMessage("查询成功");
		return entity;
	}

	public void setManuscriptManager(ManuscriptManager manuscriptManager) {
		this.manuscriptManager = manuscriptManager;
	}

}
